package bk

import (
	"gitee.com/youbeiwuhuan/gin-practice/gin-knife/handlers"
	"gitee.com/youbeiwuhuan/gin-practice/gin-knife/hooks"

	"github.com/gin-gonic/gin"
	"github.com/loopfz/gadgeto/tonic"
)

func main() {
	// 定义全局的错误处理逻辑
	tonic.SetErrorHook(hooks.ErrHook)
	// 定义向前端返回数据的默认格式和前端请求默认的MediaType,MediaType默认application/json
	tonic.SetRenderHook(hooks.RenderHook, "")
	// 定义参数绑定，可以在参数绑定中加入一些扩展逻辑，暂时不需要
	//tonic.SetBindHook()
	// 执行前后
	tonic.SetExecHook(hooks.ExecHook)

	r := gin.Default()
	handlers.AddGroups(r)

	r.Run(":8080")
}
